import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录',
        isPublic: true
    },
    component: resolve => {
        require(['@/views/login.vue'], resolve);
    }
};
export const portalRouter = {
    path: '/portal',
    name: 'portal',
    meta: {
        title: '门户容器',
        isPublic: true
    },
    component: resolve => {
        require(['@/views/my-views/portal/index.vue'], resolve);
    },
    children: [
        {
            path: 'home', title: '首页', name: 'portal_home', component: resolve => {
                require(['@/views/my-views/portal/home.vue'], resolve);
            }
        },
        {
            path: 'regist', title: '注册', name: 'portal_regist', component: resolve => {
                require(['@/views/my-views/portal/regist.vue'], resolve);
            }
        },
        // { path: 'demo', title: '首页demo', name: 'portal_demo', component: resolve => { require(['@/views/portal/demo.vue'], resolve); } },
        // { path: 'goodslist', title: '商品列表', name: 'goods_list', component: resolve => { require(['@/views/portal/goods-list.vue'], resolve); } },

    ]
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => {
        require(['@/views/error-page/404.vue'], resolve);
    }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => {
        require(['@//views/error-page/403.vue'], resolve);
    }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => {
        require(['@/views/error-page/500.vue'], resolve);
    }
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: resolve => {
        require(['@/views/form/article-publish/preview.vue'], resolve);
    }
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => {
        require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve);
    }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    component: Main,
    children: [
        // { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } },
        {
            path: 'ownspace',
            title: '个人中心',
            name: 'ownspace_index',
            component: resolve => {
                require(['@/views/own-space/own-space.vue'], resolve);
            }
        },
        {
            path: 'order/:order_id',
            title: '订单详情',
            name: 'order_info',
            component: resolve => {
                require(['@/views/advanced-router/component/order-info.vue'], resolve);
            }
        },  // 用于展示动态路由
        {
            path: 'shopping',
            title: '购物详情',
            name: 'shopping',
            component: resolve => {
                require(['@/views/advanced-router/component/shopping-info.vue'], resolve);
            }
        },  // 用于展示带参路由
        {
            path: 'message',
            title: '消息中心',
            name: 'message_index',
            component: resolve => {
                require(['@/views/message/message.vue'], resolve);
            }
        }
    ]
};
// 新添加啊路由信息
export const myOtherRouter = {
    path: '/',
    name: 'myOtherRouter',
    component: Main,
    children: [
        {
            path: 'home_index',
            title: '首页',
            icon: 'home',
            name: 'home_index',
            component: resolve => {
                require(['@/views/my-views/home/index.vue'], resolve);
            }
        },
        {
            path: 'volunteer_favorite',
            title: '志愿收藏',
            icon: 'star',
            name: 'volunteer_favorite',
            component: resolve => {
                require(['@/views/my-views/volunteerFavorite/volunteerFavorite.vue'], resolve);
            }
        },
        {
            path: 'competitive_information',
            title: '竞争情报',
            icon: 'eye',
            name: 'competitive_information',
            component: resolve => {
                require(['@/views/my-views/competitiveInformation/index.vue'], resolve);
            }
        },
        // {
        //     path: 'expert_consultation',
        //     title: '专家咨询',
        //     icon: 'radio-waves',
        //     name: 'expert_consultation',
        //     component: resolve => {
        //         require(['@/views/my-views/expertConsultation/index.vue'], resolve);
        //     }
        // },
        {
            path: 'test',
            title: '霍兰德性格职业测试',
            icon: 'radio-waves',
            name: 'test',
            component: resolve => {
                require(['@/views/my-views/test/notice.vue'], resolve);
            }
        },
        {
            path: 'my_rankings',
            // title: '我的排名',
            // icon: 'person',
            name: 'my_rankings',
            component: resolve => {
                require(['@/views/my-views/myRankings/index.vue'], resolve);
            }
        }
    ]
};

// 新添加啊路由信息
export const newMyOtherRouter = {
    path: '/',
    name: 'newMyOtherRouter',
    component: Main,
    children: [
        {
            path: 'volunteer_favorite_history',
            name: 'volunteer_favorite_history',
            component: resolve => {
                require(['@/views/my-views/volunteerFavorite/volunteerHistory.vue'], resolve);
            }
        },
        {
            path: 'volunteer_favorite_pk',
            name: 'volunteer_favorite_pk',
            component: resolve => {
                require(['@/views/my-views/volunteerFavorite/volunteerPk.vue'], resolve);
            }
        },
        {
            path: 'volunteer_favorite_introduction',
            name: 'volunteer_favorite_introduction',
            component: resolve => {
                require(['@/views/my-views/volunteerFavorite/volunteerIntroduction.vue'], resolve);
            }
        },
        {
            path: 'volunteer_favorite_job',
            name: 'volunteer_favorite_job',
            component: resolve => {
                require(['@/views/my-views/volunteerFavorite/volunteerJob.vue'], resolve);
            }
        },
        {
            path: 'intelligence_student',
            name: 'intelligence_student',
            component: resolve => {
                require(['@/views/my-views/competitiveInformation/intelligence_student.vue'], resolve);
            }
        },
        {
            path: 'intelligence_opponent',
            name: 'intelligence_opponent',
            component: resolve => {
                require(['@/views/my-views/competitiveInformation/intelligence_opponent.vue'], resolve);
            }
        },
        {
            path: 'intelligence_ranking',
            name: 'intelligence_ranking',
            component: resolve => {
                require(['@/views/my-views/competitiveInformation/intelligence_ranking.vue'], resolve);
            }
        },
        {
            path: 'intelligence_grade',
            name: 'intelligence_grade',
            component: resolve => {
                require(['@/views/my-views/competitiveInformation/intelligence_grade.vue'], resolve);
            }
        },
        {
            path: '/test/question',
            title: '测试页',
            name: 'question',
            component: resolve => {
                require(['@/views/my-views/test/test.vue'], resolve);
            }
        },
        {
            path: '/test/result',
            title: '测试结果',
            name: 'result',
            component: resolve => {
                require(['@/views/my-views/test/result.vue'], resolve);
            }
        }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/access',
        icon: 'key',
        name: 'access',
        title: '权限管理',
        component: Main,
        children: [
            {
                path: 'index',
                title: '权限管理',
                name: 'access_index',
                component: resolve => {
                    require(['@/views/access/access.vue'], resolve);
                }
            }
        ]
    },
    {
        path: '/access-test',
        icon: 'lock-combination',
        title: '权限测试页',
        name: 'accesstest',
        access: 0,
        component: Main,
        children: [
            {path: 'index', title: '权限测试页', name: 'accesstest_index'}
        ]
    },
    {
        path: '/international',
        icon: 'earth',
        title: {i18n: 'international'},
        name: 'international',
        component: Main,
        children: [
            {
                path: 'index',
                title: {i18n: 'international'},
                name: 'international_index',
                component: resolve => {
                    require(['@/views/international/international.vue'], resolve);
                }
            }
        ]
    },
    {
        path: '/component',
        icon: 'social-buffer',
        name: 'component',
        title: '组件',
        component: Main,
        children: [
            {
                path: 'text-editor',
                icon: 'compose',
                name: 'text-editor',
                title: '富文本编辑器',
                component: resolve => {
                    require(['@/views/my-components/text-editor/text-editor.vue'], resolve);
                }
            },
            {
                path: 'md-editor',
                icon: 'pound',
                name: 'md-editor',
                title: 'Markdown编辑器',
                component: resolve => {
                    require(['@/views/my-components/markdown-editor/markdown-editor.vue'], resolve);
                }
            },
            {
                path: 'image-editor',
                icon: 'crop',
                name: 'image-editor',
                title: '图片预览编辑',
                component: resolve => {
                    require(['@/views/my-components/image-editor/image-editor.vue'], resolve);
                }
            },
            {
                path: 'draggable-list',
                icon: 'arrow-move',
                name: 'draggable-list',
                title: '可拖拽列表',
                component: resolve => {
                    require(['@/views/my-components/draggable-list/draggable-list.vue'], resolve);
                }
            },
            {
                path: 'area-linkage',
                icon: 'ios-more',
                name: 'area-linkage',
                title: '城市级联',
                component: resolve => {
                    require(['@/views/my-components/area-linkage/area-linkage.vue'], resolve);
                }
            },
            {
                path: 'file-upload',
                icon: 'android-upload',
                name: 'file-upload',
                title: '文件上传',
                component: resolve => {
                    require(['@/views/my-components/file-upload/file-upload.vue'], resolve);
                }
            },
            {
                path: 'count-to',
                icon: 'arrow-graph-up-right',
                name: 'count-to',
                title: '数字渐变',
                component: resolve => {
                    require(['@/views/my-components/count-to/count-to.vue'], resolve);
                }
            }
        ]
    },
    {
        path: '/form',
        icon: 'android-checkbox',
        name: 'form',
        title: '表单编辑',
        component: Main,
        children: [
            {
                path: 'artical-publish',
                title: '文章发布',
                name: 'artical-publish',
                icon: 'compose',
                component: resolve => {
                    require(['@/views/form/article-publish/article-publish.vue'], resolve);
                }
            },
            {
                path: 'workflow',
                title: '工作流',
                name: 'workflow',
                icon: 'arrow-swap',
                component: resolve => {
                    require(['@/views/form/work-flow/work-flow.vue'], resolve);
                }
            }

        ]
    },
    {
        path: '/tables',
        icon: 'ios-grid-view',
        name: 'tables',
        title: '表格',
        component: Main,
        children: [
            {
                path: 'dragableTable',
                title: '可拖拽排序',
                name: 'dragable-table',
                icon: 'arrow-move',
                component: resolve => {
                    require(['@/views/tables/dragable-table.vue'], resolve);
                }
            },
            {
                path: 'editableTable',
                title: '可编辑表格',
                name: 'editable-table',
                icon: 'edit',
                component: resolve => {
                    require(['@/views/tables/editable-table.vue'], resolve);
                }
            },
            {
                path: 'searchableTable',
                title: '可搜索表格',
                name: 'searchable-table',
                icon: 'search',
                component: resolve => {
                    require(['@/views/tables/searchable-table.vue'], resolve);
                }
            },
            {
                path: 'exportableTable',
                title: '表格导出数据',
                name: 'exportable-table',
                icon: 'code-download',
                component: resolve => {
                    require(['@/views/tables/exportable-table.vue'], resolve);
                }
            },
            {
                path: 'table2image',
                title: '表格转图片',
                name: 'table-to-image',
                icon: 'images',
                component: resolve => {
                    require(['@/views/tables/table-to-image.vue'], resolve);
                }
            }
        ]
    },
    {
        path: '/advanced-router',
        icon: 'ios-infinite',
        name: 'advanced-router',
        title: '高级路由',
        component: Main,
        children: [
            {
                path: 'mutative-router',
                title: '动态路由',
                name: 'mutative-router',
                icon: 'link',
                component: resolve => {
                    require(['@/views/advanced-router/mutative-router.vue'], resolve);
                }
            },
            {
                path: 'argument-page',
                title: '带参页面',
                name: 'argument-page',
                icon: 'android-send',
                component: resolve => {
                    require(['@/views/advanced-router/argument-page.vue'], resolve);
                }
            }
        ]
    },
    {
        path: '/error-page',
        icon: 'android-sad',
        title: '错误页面',
        name: 'errorpage',
        component: Main,
        children: [
            {
                path: 'index',
                title: '错误页面',
                name: 'errorpage_index',
                component: resolve => {
                    require(['@/views/error-page/error-page.vue'], resolve);
                }
            }
        ]
    }, {
        path: '/vechart',
        icon: 'earth',
        title: 'vechart',
        name: 'vechart',
        component: Main,
        children: [
            {
                path: 'demo',
                icon: 'compose',
                name: 'demo',
                title: 'demo',
                component: resolve => {
                    require(['@/views/my-views/vechart/demo.vue'], resolve);
                }
            }]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter, portalRouter,
    myOtherRouter,
    newMyOtherRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
